﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ProcessWarranty.aspx.cs" Inherits="MonkeyWarranty.Web.WarrantyTickets.ProcessWarranty" %>
<%@ Import Namespace="Resources" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <title>
        <%= GlobalStrings.ProcessWarranty %></title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        <a href="List.aspx"><%= GlobalStrings.Ticket %></a>&nbsp;|&nbsp;
        <a href="WaitingWarranty.aspx"><%= GlobalStrings.WaitingWarranty %></a>&nbsp;|&nbsp;
        <a href="ProcessWarranty.aspx" class="a-selected"><%= GlobalStrings.ProcessWarranty %></a>&nbsp;|&nbsp;
        <a href="ReceivedProducts.aspx"><%= GlobalStrings.ProcessReceivedProducts %></a>&nbsp;|&nbsp;
        <a href="LendProducts.aspx"><%= GlobalStrings.ProcessLendProducts %></a>
    </p>
    
    <div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
        <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
            <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tabs-1"><%= GlobalStrings.AtTechnical %></a></li>
            <li class="ui-state-default ui-corner-top"><a href="#tabs-2"><%= GlobalStrings.AtProvider %></a></li>
        </ul>
        <div id="tabs-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
            <div id="ProductsAtTechnical"></div>
        </div>
        <div id="tabs-2" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
            <div id="ProductsAtSupplier"></div>
        </div>
    </div>

    <p>
    </p>

    <script type="text/javascript">
        $(document).ready(function() {
            $("#tabs").tabs();
            LoadProductsAtTechnical();
            LoadProductsAtSupplier();
        });
    </script>
    
    <script type="text/javascript">
        function LoadProductsAtTechnical() {
            $('#ProductsAtTechnical').jtable({
                paging: true,
                pageSize: 15,
                sorting: true,
                defaultSorting: 'Name ASC',
                actions: {
                    listAction: 'ProcessWarranty.aspx/ProductsAtTechnical'
                },
                fields: {
                    Id: {
                        key: true,
                        create: false,
                        edit: false,
                        list: false
                    },
                    TicketCode: {
                        title: '<%= GlobalStrings.TicketCode %>',
                        display: function (data) {
                            return '<a href="ProcessProduct.aspx?id=' + data.record.Id + '" >' + data.record.TicketCode + '</a>';
                        }
                    },
                    Code: {
                        title: '<%= GlobalStrings.ProductCode %>',
                        display: function(data) {
                            return '<a href="ProcessProduct.aspx?id=' + data.record.Id + '" >' + data.record.Code + '</a>';
                        }
                    },
                    Name: {
                        title: '<%= GlobalStrings.ProductName %>',
                        display: function(data) {
                            return '<a href="ProcessProduct.aspx?id=' + data.record.Id + '" >' + data.record.Name + '</a>';
                        }
                    },
                    EmployeeName:{title:'<%=GlobalStrings.TechnicalEmployees %>'},
                    Model: {
                        title: '<%= GlobalStrings.Model %>',
                        sorting: false
                    },
                    ManufacturerName: {
                        title: '<%= GlobalStrings.Manufacturers %>',
                        sorting: false
                    },
                    Serial: {
                        title: '<%= GlobalStrings.Serial %>',
                        sorting: false
                    },
                    Quantity: {
                        width: '5%',
                        title: '<%= GlobalStrings.Quantity %>',
                        sorting: false
                    },
                    WarrantyTypeName: {
                        title: '<%= GlobalStrings.WarrantyType %>',
                        sorting: false
                    },
                    ReceivedFromName: { title: '<%= GlobalStrings.ReceivedFrom %>', sorting: false },
                    DealerEmployeeName: { title: '<%= GlobalStrings.ReceivedFromName %>', width: '20%', sorting: false },
                    CustomerName: { title: '<%= GlobalStrings.Customers %>', sorting: false },
                    Phone: { title: '<%= GlobalStrings.Phone %>', sorting: false }
//                    ErrorName: {
//                        title: '<%= GlobalStrings.ErrorCode %>'
//                    },
//                    WarrantyDate: {
//                        title: '<%= GlobalStrings.WarrantyDate %>',
//                        type: 'date',
//                        displayFormat: 'dd/mm/yy'
//                    }
                }
            });

            $('#ProductsAtTechnical').jtable('load');
        }

        function LoadProductsAtSupplier() {
            $('#ProductsAtSupplier').jtable({
                paging: true,
                pageSize: 15,
                sorting: true,
                defaultSorting: 'Name ASC',
                actions: {
                    listAction: 'ProcessWarranty.aspx/ProductsAtSupplier'
                },
                fields: {
                    Id: {
                        key: true,
                        create: false,
                        edit: false,
                        list: false
                    },
                    TicketCode: {
                        title: '<%= GlobalStrings.TicketCode %>',
                        display: function (data) {
                            return '<a href="ProcessProduct.aspx?id=' + data.record.Id + '" >' + data.record.TicketCode + '</a>';
                        }
                    },
                    Code: {
                        title: '<%= GlobalStrings.ProductCode %>',
                        display: function(data) {
                            return '<a href="ProcessProduct.aspx?id=' + data.record.Id + '" >' + data.record.Code + '</a>';
                        }
                    },
                    Name: {
                        title: '<%= GlobalStrings.ProductName %>',
                        display: function(data) {
                            return '<a href="ProcessProduct.aspx?id=' + data.record.Id + '" >' + data.record.Name + '</a>';
                        }
                    },
                    SupplierName: { title: '<%= GlobalStrings.AtSupplier %>' },
                    Model: {
                        title: '<%= GlobalStrings.Model %>',
                        sorting: false
                    },
                    ManufacturerName: {
                        title: '<%= GlobalStrings.Manufacturers %>',
                        sorting: false
                    },
                    Serial: {
                        title: '<%= GlobalStrings.Serial %>',
                        sorting: false
                    },
                    Quantity: {
                        width: '5%',
                        title: '<%= GlobalStrings.Quantity %>',
                        sorting: false
                    },
                    WarrantyTypeName: {
                        title: '<%= GlobalStrings.WarrantyType %>',
                        sorting: false
                    },
                    ReceivedFromName: { title: '<%= GlobalStrings.ReceivedFrom %>', sorting: false },
                    DealerEmployeeName: { title: '<%= GlobalStrings.ReceivedFromName %>', width: '20%', sorting: false },
                    CustomerName: { title: '<%= GlobalStrings.Customers %>', sorting: false },
                    Phone: { title: '<%= GlobalStrings.Phone %>', sorting: false }
                //                    ErrorName: {
                //                        title: '<%= GlobalStrings.ErrorCode %>'
                //                    },
                //                    WarrantyDate: {
                //                        title: '<%= GlobalStrings.WarrantyDate %>',
                //                        type: 'date',
                //                        displayFormat: 'dd/mm/yy'
                //                    }
                }
            });

            $('#ProductsAtSupplier').jtable('load');
        }
    </script>
</asp:Content>